package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements Operation {
    @Override
    public void work(BookList bookList) {
        System.out.println("归还一本书!");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入要归还的图书名称：");
        String name = scanner.nextLine();
        Book book = bookList.getBookByName(name);
        if (book != null) {
            book.setBorrowed(false);
            System.out.println("归还成功!");
        } else {
            System.out.println("没有查找到 " + name);
        }
    }
}
